function loginout() {
    $.ajax({
        type: 'POST',
        url: "user/loginout",
        dataType: "json",
        success: function (data) {
            location.href = "login.html";
        }
    });
}
//============================================= sweet titles// 鼠标提示，比如鼠标悬浮，显示提示

function ieShowTip(entity) {
	showTip(null, entity);
}

function showTip(e, entity) {
	var observateContentTitle = entity.observateContentTitle == null ? '' : entity.observateContentTitle;
	var addTime = entity.addTime == null ? '' : entity.addTime;
	var observateDate = entity.observateDate == null ? '' : entity.observateDate;
	var observateTime = entity.observateTime == null ? '' : entity.observateTime;
	var observateWorkUnit = entity.observateWorkUnit == null ? '' : entity.observateWorkUnit;
	var observator = entity.observator == null ? '' : entity.observator;
	var area = '';
	var securityActivity = '';
	var notSecurityActivity = '';
	if (entity.checkArea != null) {
		area = entity.checkArea.area == null ? '' : entity.checkArea.area;
		securityActivity = entity.checkArea.securityActivity == null ? '' : entity.checkArea.securityActivity;
		notSecurityActivity = entity.checkArea.notSecurityActivity == null ? '' : entity.checkArea.notSecurityActivity;
	}
	var rectificationRequest = entity.rectificationRequest == null ? '' : entity.rectificationRequest;
	var rectificationPerson = entity.rectificationPerson == null ? '' : entity.rectificationPerson;
	var rectificationUnit = entity.rectificationUnit == null ? '' : entity.rectificationUnit;
	var completeDate = entity.completeDate == null ? '' : entity.completeDate;
	var isStopWork = entity.isStopWork == null ? '' : entity.isStopWork;
	var checkResult = entity.checkResult == null ? '' : entity.checkResult;
    var tooltip = '<div id="tooltip">' +
    		'<div class="panel">' + 
    			'<div class="banner">' +
    				'<h2 class="title">详细信息</h2>' +
    			'</div>' + 
    			'<div class="content">' + 
'<table class="table-form" width="100%" border="1" cellspacing="0" cellpadding="0">' + 
'<tr>' + 
'<td width="62">观察内容标题</td>' + 
'<td colspan="3">' + observateContentTitle + '</td>' + 
'<td  width="117">添加时间</td>' + 
'<td>' + addTime + '</td>' + 
'</tr>' + 
'<tr>' + 
'<td>观察日期</td>' + 
'<td width="189">' + observateDate + '</td>' + 
'<td width="23" rowspan="2">观察单位</td>' + 
'<td width="320" rowspan="2">' + observateWorkUnit + '</td>' + 
'<td width="117" rowspan="2">观察人</td>' + 
'<td width="237" rowspan="2">' + observator + '</td>' + 
'</tr>' + 
'<tr>' + 
'<td >观察时间（不小于1小时）</td>' + 
'<td>' + observateTime + '小时</td>' + 
'</tr>' + 
'<tr class="font" bgcolor="#FFFFFF">' + 
'<td colspan="2">员工的反应</td>' + 
'<td colspan="2">个人防护装备</td>' + 
'<td colspan="2">规程</td>' + 
'</tr>' + 
'<tr class="font">' + 
'<td colspan="2" >观察到人员的异常反应</td>' + 
'<td colspan="2">未使用或未正确使用；是否完好</td>' + 
'<td colspan="2">&nbsp;</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2"><input type="checkbox" name="tzgrfhzb" id="tzgrfhzb" class="select-box">调整个人防护装备</td>' + 
'<td colspan="2"><input type="checkbox" name="yjhyb" id="yjhyb" class="select-box">眼睛和脸部</td>' + 
'<td colspan="2"><input type="checkbox" name="myjl" id="myjl" class="select-box">没有建立</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2"><input type="checkbox" name="gbyldwz" id="gbyldwz" class="select-box">改变原来的位置</td>' + 
'<td colspan="2"><input type="checkbox" name="eb" id="eb" class="select-box">耳部</td>' + 
'<td colspan="2" ><input type="checkbox" name="bxy" id="bxy" class="select-box">不适用</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2"><input type="checkbox" name="cxapgz" id="cxapgz" class="select-box">重新安排工作</td>' + 
'<td colspan="2"><input type="checkbox" name="tb" id="tb" class="select-box">头部</td>' + 
'<td colspan="2" >  <input type="checkbox" name="bkhq" id="bkhq" class="select-box">不可以获取</td>' + 
'<tr>' + 
'<td colspan="2"><input type="checkbox" name="tzgz" id="tzgz" class="select-box">停止工作</td>' + 
'<td colspan="2"><input type="checkbox" name="shsb" id="shsb" class="select-box">手和手臂</td>' + 
'<td colspan="2"><input type="checkbox" name="ygbzdhblj" id="ygbzdhblj" class="select-box">员工不知道或不理解</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2"><input type="checkbox" name="jsdx" id="jsdx" class="select-box">接上地线</td>' + 
'<td colspan="2"><input type="checkbox" name="jhtb" id="jhtb" class="select-box">脚和腿部</td>' + 
'<td colspan="2"><input type="checkbox" name="myzzzx" id="myzzzx" class="select-box">没有遵照执行</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2"><input type="checkbox" name="ssbq" id="ssbq" class="select-box">上锁挂签</td>' + 
'<td colspan="2"><input type="checkbox" name="hxxt" id="hxxt" class="select-box">呼吸系统</td>' + 
'<td colspan="2"><input type="checkbox" name="Procedure_qt" id="Procedure_qt" class="select-box">其他</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2"><input type="checkbox" name="StaffReflect_qt" id="StaffReflect_qt" class="select-box">其他</td>' + 
'<td colspan="2"><input type="checkbox" name="qg" id="qg"class="select-box">躯干</td>' + 
'<td colspan="2">&nbsp;</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2"><label for="checkbox19"class="select-box"></label></td>' + 
'<td colspan="2"><input type="checkbox" name="PersonalProtectiveEquipment_qt" id="PersonalProtectiveEquipment_qt" class="select-box">其他</td>' + 
'<td colspan="2">&nbsp;</td>' + 
'</tr>' + 
'<tr class="font" bgcolor="#FFFFFF">' + 
'<td colspan="2">员工的位置</td>' + 
'<td colspan="2">工具与设备</td>' + 
'<td colspan="2">人体工效学</td>' + 
'</tr>' + 
'<tr class="font">' + 
'<td colspan="2">可能</td>' + 
'<td colspan="2">&nbsp;</td>' + 
'<td colspan="2">办公室 操作和检维修环境</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2">' + 
'<input type="checkbox" name="bzj" id="bzj" class="select-box">被撞击</td>' + 
'<td colspan="2"><input type="checkbox" name="bshgzy" id="bshgzy" class="select-box">不适合该作业</td>' + 
'<td colspan="2"><input type="checkbox" name="sffhrtgxxyl" id="sffhrtgxxyl" class="select-box">是否符合人体工效学原理</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2">' + 
'<input type="checkbox" name="bjz" id="bjz"class="select-box">被夹住</td>' + 
'<td colspan="2"><input type="checkbox" name="wzqsygjhsb" id="wzqsygjhsb"class="select-box">未正确使用工具和设备</td>' + 
'<td colspan="2"><input type="checkbox" name="cfddz" id="cfddz"class="select-box">重复的动作</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2">' + 
'<input type="checkbox" name="gczl" id="gczl"class="select-box">高处坠落</td>' + 
'<td colspan="2"><input type="checkbox" name="gjhsbbsbaq" id="gjhsbbsbaq"class="select-box">工具和设备本身不安全</td>' + 
'<td colspan="2"><input type="checkbox" name="qgwz" id="qgwz"class="select-box">躯干位置</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2"><input type="checkbox" name="bdhhd" id="bdhhd"class="select-box">绊倒或滑倒</td>' + 
'<td  class="font" colspan="2">环境整洁</td>' + 
'<td colspan="2"><input type="checkbox" name="zs" id="zs"class="select-box">姿势</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2"><input type="checkbox" name="jcjdwddwt" id="jcjdwddwt" class="select-box">接触极端温度的物体</td>' + 
'<td colspan="2"><input type="checkbox" name="zyqysfzjyx" id="zyqysfzjyx"class="select-box">作业区域是否整洁有序</td>' + 
'<td colspan="2"><input type="checkbox" name="gzcs" id="gzcs "class="select-box">工作场所</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2">' + 
'<input type="checkbox" name="cd" id="cd" class="select-box">触电</td>' + 
'<td colspan="2"><input type="checkbox" name="gzcssfzjyx" id="gzcssfzjyx"class="select-box">工作场所是否整洁有序</td>' + 
'<td colspan="2"><input type="checkbox" name="gzqysj" id="gzqysj"class="select-box">工作区域设计</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2">' + 
'<input type="checkbox" name="jcxrtsyhwz" id="jcxrtsyhwz"class="select-box">接触、吸入或吞食有害物质</td>' + 
'<td colspan="2"><input type="checkbox" name="cljgjdbfsfsd" id="cljgjdbfsfsd"class="select-box">材料及工具的摆放是否适当</td>' + 
'<td colspan="2"><input type="checkbox" name="gjhbs" id="gjhbs"class="select-box">工具和把手</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2">' + 
'<input type="checkbox" name="bshdzs" id="bshdzs"class="select-box">不适合的姿势</td>' + 
'<td colspan="2"><input type="checkbox" name="CleanEnvironment_qt" id="CleanEnvironment_qt"class="select-box">其他</td>' + 
'<td colspan="2"><input type="checkbox" name="zm" id="zm"class="select-box">照明</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2">' + 
'<input type="checkbox" name="jczdsb" id="jczdsb"class="select-box">接触转动设备</td>' + 
'<td colspan="2">&nbsp;</td>' + 
'<td colspan="2"><input type="checkbox" name="zy" id="zy"class="select-box">噪音</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2">' + 
'<input type="checkbox" name="byfhgz" id="byfhgz"class="select-box">搬运负荷过重</td>' + 
'<td colspan="2">&nbsp;</td>' + 
'<td colspan="2"><input type="checkbox" name="Ergonomics_qt" id="Ergonomics_qt"class="select-box">其他</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2">' + 
'<input type="checkbox" name="jczhdsb" id="jczhdsb"class="select-box">接触震动设备</td>' + 
'<td colspan="2">&nbsp;</td>' + 
'<td colspan="2">&nbsp;</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2"><input type="checkbox" name="StaffPosition_qt" id="StaffPosition_qt"class="select-box">其他</td>' + 
'<td colspan="2">&nbsp;</td>' + 
'<td colspan="2">&nbsp;</td>' + 
'</tr>' + 
'<tr class="font" bgcolor="#FFFFFF">' + 
'<td colspan="2">观察区域</td>' + 
'<td colspan="2">观察到的安全行为</td>' + 
'<td colspan="2">观察到的不安全行为和状态描述</td>' + 
'</tr>' + 
'<tr>' + 
'<td colspan="2">' + area + '</td>' + 
'<td colspan="2">' + securityActivity + '</td>' + 
'<td colspan="2">' + notSecurityActivity + '</td>' + 
'</tr>' + 
'<tr>' + 
'<td  class="font"colspan="2">整改意见及要求：</td>' + 
'<td colspan="4">' + rectificationRequest + '</td>' + 
'</tr>' + 
'<tr>' + 
'<td  class="font" colspan="2">整改责任人：</td>' + 
'<td colspan="2">' + rectificationPerson + '</td>' + 
'<td class="font">完成日期：</td>' + 
'<td>' + completeDate + '</td>' + 
'</tr>' + 
'<tr>' + 
'<td class="font"colspan="2">整改单位：</td>' + 
'<td colspan="2">' + rectificationUnit + '</td>' + 
'<td class="font">是否使用停止作业卡：</td>' + 
'<td>' + isStopWork + '</td>' + 
'</tr>' + 
'<tr >' + 
'<td  class="font"colspan="2">请审核</td>' + 
'<td colspan="2">' + checkResult + '</td>' + 
'<td colspan="2">&nbsp;</td>' + 
'</tr>' + 
'</table>' + 
'<div class="footer4" >' + 
' <a class="button round dark refer" onclick="closeTip();">返&nbsp;回</a>' + 
'</div>' + 
'</div>' +           
'</div>';
    tooltip += "</div>";
    $('body').append(tooltip);
    $('#tooltip .table1 td').css({
        "border": "1px solid #9EA3B2",
        "color": "#4B4E55"
    });
    $('#tooltip .table2 td').css({
        "border": "0px",
        "color": "red"
    });
    $('#tooltip')
        .css({
            "position": "absolute",
            "top": ($('#contont').offset().top + 10) + "px",
            "left": ($('#contont').offset().left + 260)  + "px"
        }).show('fast'); 
	if (entity.staffReflect != null) {
	    $('#tzgrfhzb').prop('checked', entity.staffReflect.tzgrfhzb);
	    $('#gbyldwz').prop('checked', entity.staffReflect.gbyldwz);
	    $('#cxapgz').prop('checked', entity.staffReflect.cxapgz);
	    $('#tzgz').prop('checked', entity.staffReflect.tzgz);
	    $('#jsdx').prop('checked', entity.staffReflect.jsdx);
	    $('#ssbq').prop('checked', entity.staffReflect.ssbq);
	    $('#StaffReflect_qt').prop('checked', entity.staffReflect.qt);
	}
	if (entity.personalProtectiveEquipment != null) {
	    $('#tzgrfhzb').prop('checked', entity.personalProtectiveEquipment.yjhyb);
	    $('#eb').prop('checked', entity.personalProtectiveEquipment.eb);
	    $('#tb').prop('checked', entity.personalProtectiveEquipment.tb);
	    $('#shsb').prop('checked', entity.personalProtectiveEquipment.shsb);
	    $('#jhtb').prop('checked', entity.personalProtectiveEquipment.jhtb);
	    $('#hxxt').prop('checked', entity.personalProtectiveEquipment.hxxt);
	    $('#qg').prop('checked', entity.personalProtectiveEquipment.qg);
	    $('#PersonalProtectiveEquipment_qt').prop('checked', entity.personalProtectiveEquipment.qt);
	}
	if (entity.procedure != null) {
	    $('#myjl').prop('checked', entity.procedure.myjl);
	    $('#bxy').prop('checked', entity.procedure.bxy);
	    $('#bkhq').prop('checked', entity.procedure.bkhq);
	    $('#ygbzdhblj').prop('checked', entity.procedure.ygbzdhblj);
	    $('#myzzzx').prop('checked', entity.procedure.myzzzx);
	    $('#Procedure_qt').prop('checked', entity.procedure.qt);
	}
	if (entity.staffPosition != null) {
	    $('#bzj').prop('checked', entity.staffPosition.bzj);
	    $('#bjz').prop('checked', entity.staffPosition.bjz);
	    $('#gczl').prop('checked', entity.staffPosition.gczl);
	    $('#bdhhd').prop('checked', entity.staffPosition.bdhhd);
	    $('#jcjdwddwt').prop('checked', entity.staffPosition.jcjdwddwt);
	    $('#cd').prop('checked', entity.staffPosition.cd);
	    $('#jcxrtsyhwz').prop('checked', entity.staffPosition.jcxrtsyhwz);
	    $('#bshdzs').prop('checked', entity.staffPosition.bshdzs);
	    $('#jczdsb').prop('checked', entity.staffPosition.jczdsb);
	    $('#byfhgz').prop('checked', entity.staffPosition.byfhgz);
	    $('#jczhdsb').prop('checked', entity.staffPosition.jczhdsb);
	    $('#StaffPosition_qt').prop('checked', entity.staffPosition.qt);
	}
	if (entity.toolsEquipment != null) {
	    $('#bshgzy').prop('checked', entity.toolsEquipment.bshgzy);
	    $('#wzqsygjhsb').prop('checked', entity.toolsEquipment.wzqsygjhsb);
	    $('#gjhsbbsbaq').prop('checked', entity.toolsEquipment.gjhsbbsbaq);
	}
	if (entity.cleanEnvironment != null) {
	    $('#zyqysfzjyx').prop('checked', entity.cleanEnvironment.zyqysfzjyx);
	    $('#gzcssfzjyx').prop('checked', entity.cleanEnvironment.gzcssfzjyx);
	    $('#cljgjdbfsfsd').prop('checked', entity.cleanEnvironment.cljgjdbfsfsd);
	    $('#CleanEnvironment_qt').prop('checked', entity.cleanEnvironment.qt);
	}
	if (entity.ergonomics != null) {
	    $('#sffhrtgxxyl').prop('checked', entity.ergonomics.sffhrtgxxyl);
	    $('#cfddz').prop('checked', entity.ergonomics.cfddz);
	    $('#qgwz').prop('checked', entity.ergonomics.qgwz);
	    $('#zs').prop('checked', entity.ergonomics.zs);
	    $('#gzcs').prop('checked', entity.ergonomics.gzcs);
	    $('#gzqysj').prop('checked', entity.ergonomics.gzqysj);
	    $('#gjhbs').prop('checked', entity.ergonomics.gjhbs);
	    $('#zm').prop('checked', entity.ergonomics.zm);
	    $('#zy').prop('checked', entity.ergonomics.zy);
	    $('#Ergonomics_qt').prop('checked', entity.ergonomics.qt);
	}
    $('input[type="checkbox"]').prop('disabled', true);
}

function closeTip() {
    $('#tooltip').remove();
}

function submit() {
    $.ajax({
        type: 'POST',
        url: "record/add",
        data: { 
        	"observateContentTitle": $("#observateContentTitle").val(),
        	"addTime": $("#addTime").datetimebox("getValue"),
        	"observateDate": $("#observateDate").datebox("getValue"),
        	"observateTime": $("#observateTime").val(),
        	"observateWorkUnit": $("#observateWorkUnit").val(),
        	"observator": $("#observator").val(),
        	"staffReflect.tzgrfhzb": $("#tzgrfhzb").is(':checked'),
        	"staffReflect.gbyldwz": $("#gbyldwz").is(':checked'),
    		"staffReflect.cxapgz": $("#cxapgz").is(':checked'),
			"staffReflect.tzgz": $("#tzgz").is(':checked'),
			"staffReflect.jsdx": $("#jsdx").is(':checked'),
			"staffReflect.ssbq": $("#ssbq").is(':checked'),
			"staffReflect.qt": $("#StaffReflect_qt").is(':checked'),
			"personalProtectiveEquipment.yjhyb": $("#yjhyb").is(':checked'),
			"personalProtectiveEquipment.eb": $("#eb").is(':checked'),
			"personalProtectiveEquipment.tb": $("#tb").is(':checked'),
			"personalProtectiveEquipment.shsb": $("#shsb").is(':checked'),
			"personalProtectiveEquipment.jhtb": $("#jhtb").is(':checked'),
			"personalProtectiveEquipment.hxxt": $("#hxxt").is(':checked'),
			"personalProtectiveEquipment.qg": $("#qg").is(':checked'),
			"personalProtectiveEquipment.qt": $("#PersonalProtectiveEquipment_qt").is(':checked'),
			"procedure.myjl": $("#myjl").is(':checked'),
			"procedure.bxy": $("#bxy").is(':checked'),
			"procedure.bkhq": $("#bkhq").is(':checked'),
			"procedure.ygbzdhblj": $("#ygbzdhblj").is(':checked'),
			"procedure.myzzzx": $("#myzzzx").is(':checked'),
			"procedure.qt": $("#Procedure_qt").is(':checked'),
			"staffPosition.bzj": $("#bzj").is(':checked'),
			"staffPosition.bjz": $("#bjz").is(':checked'),
			"staffPosition.gczl": $("#gczl").is(':checked'),
			"staffPosition.bdhhd": $("#bdhhd").is(':checked'),
			"staffPosition.jcjdwddwt": $("#jcjdwddwt").is(':checked'),
			"staffPosition.cd": $("#cd").is(':checked'),
			"staffPosition.jcxrtsyhwz": $("#jcxrtsyhwz").is(':checked'),
			"staffPosition.bshdzs": $("bshdzs").is(':checked'),
			"staffPosition.jczdsb": $("#jczdsb").is(':checked'),
			"staffPosition.byfhgz": $("#byfhgz").is(':checked'),
			"staffPosition.jczhdsb": $("#jczhdsb").is(':checked'),
			"staffPosition.qt": $("#StaffPosition_qt").is(':checked'),
			"toolsEquipment.bshgzy": $("#bshgzy").is(':checked'),
			"toolsEquipment.wzqsygjhsb": $("#wzqsygjhsb").is(':checked'),
			"toolsEquipment.gjhsbbsbaq": $("#gjhsbbsbaq").is(':checked'),
			"cleanEnvironment.zyqysfzjyx": $("#zyqysfzjyx").is(':checked'),
			"cleanEnvironment.gzcssfzjyx": $("#gzcssfzjyx").is(':checked'),
			"cleanEnvironment.cljgjdbfsfsd": $("#cljgjdbfsfsd").is(':checked'),
			"cleanEnvironment.qt": $("#CleanEnvironment_qt").is(':checked'),
			"ergonomics.sffhrtgxxyl": $("#sffhrtgxxyl").is(':checked'),
			"ergonomics.cfddz": $("#cfddz").is(':checked'),
			"ergonomics.qgwz": $("#qgwz").is(':checked'),
			"ergonomics.zs": $("#zs").is(':checked'),
			"ergonomics.gzcs": $("#gzcs").is(':checked'),
			"ergonomics.gzqysj": $("#gzqysj").is(':checked'),
			"ergonomics.gjhbs": $("#gjhbs").is(':checked'),
			"ergonomics.zm": $("#zm").is(':checked'),
			"ergonomics.zy": $("#zy").is(':'),
			"ergonomics.qt": $("#Ergonomics_qt").is(':checked'),
    		"checkArea.area": $("#area").val(),
    		"checkArea.securityActivity": $("#securityActivity").val(),
    		"checkArea.notSecurityActivity": $("#notSecurityActivity").val(),
        	"rectificationRequest" : $("#rectificationRequest").val(),
        	"rectificationPerson" : $("#rectificationPerson").val(),
        	"rectificationUnit" : $("#rectificationUnit").val(),
        	"completeDate" : $("#completeDate").datebox("getValue"),
        	"isStopWork" : $("#isStopWork").val(),
        	"checkResult" : $("#checkResult").val()
        },
        dataType: "json",
        success: function (data) {
        	if (data.result == 1) {
        		$.messager.alert("提示", "保存成功");
        		loadList();
        	} else {
        		$.messager.alert("提示", "保存失败");
        	}
        }
    });
}